home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / Arashi 1.1 / Game Source / mtz / mtz src / needgsthelp < prev    next >
Encoding:
Text File  |  1993-01-27  |  1.5 KB  |  58 lines  |  [TEXT/KAHL]

  1. Ok, well no actually, I didnt know, but I thought I stood
  2. a fair chance.  Pulled out my handy dandy IM 6 and started
  3. plugging away.  I wrote the replace Getsalt fcn as
  4.  
  5. pascal OSErr main(selector, response)
  6. OSType    selector;
  7. long    *response;
  8. {
  9.     *response = 0x12;                /* return a value that will disable superclock */
  10.     return 0;                    
  11. }
  12.  
  13. and set its atrribs as locked and SysHeap.
  14.  
  15. Then I did my code to use it in ARASHI
  16.  
  17. ProcPtr oldGestaltFunction;
  18.  
  19. typedef pascal OSType (*PFunc)(long);
  20.  
  21. /* DisableSuperclock will set the Gestalt selector 'savr' to indicate that a         */
  22. /* screen saver, such as afterdark, is enabled already, thus superclock will        */
  23. /* not attempt to draw on the playing surface.        */
  24. void DisableSuperClock()
  25. {
  26.     OSErr    myNewErr, myReplaceErr;
  27.     int        gstFuncRsrcID = 128;
  28.     Handle    gstFuncHandle;
  29.     int        SAVRTrouble = 130;
  30.     
  31.     gstFuncHandle = GetResource('GDEF', gstFuncRsrcID);
  32.     if(gstFuncHandle == 0)
  33.         Alert(SAVRTrouble,0);
  34.     else
  35.     {
  36.         DetachResource(gstFuncHandle);
  37.         myNewErr = NewGestalt('SAVR',(ProcPtr)(*gstFuncHandle));
  38.         if(myNewErr != noErr)
  39.         {
  40.             myReplaceErr = ReplaceGestalt('SAVR', 
  41.                 (PFunc)(*gstFuncHandle),(ProcPtr)oldGestaltFunction);
  42.             if(myReplaceErr != noErr)
  43.                 Alert(SAVRTrouble,0);
  44.         }
  45.     }
  46.     DisposeHandle(gstFuncHandle);
  47. }
  48.  
  49.  
  50. but it crashes every time just after returning from DisableSuperClock.
  51. Superclock does turn off though...
  52. I have checked with MacsBug and theGDEF rsrc does seem to be at
  53.  *gstFuncHandle. I have tried with the PFunc pointer and just
  54.  the ProcPtr.
  55.  
  56. Any ideas?  I feel I must simply be overlooking something simple.
  57.  
  58.